home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / stdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-21  |  3.0 KB  |  166 lines  |  [TEXT/MPS ]

  1. /*
  2.     StdLib.h -- General utilities
  3.  
  4.     Copyright Apple Computer,Inc.    1987, 1990, 1993, 1994
  5.     All rights reserved.
  6.  
  7. */
  8.  
  9. #ifndef __STDLIB__
  10. #define __STDLIB__
  11.  
  12. #ifndef __size_t__
  13. #define __size_t__
  14. typedef unsigned int size_t;
  15. #endif
  16.  
  17. #ifndef __wchar_t__
  18. #define __wchar_t__
  19. typedef short wchar_t;
  20. #endif
  21.  
  22. #ifdef powerc
  23. #pragma options align=power
  24. #endif
  25. struct div_t {
  26.     int quot;            /* quotient */
  27.     int rem;            /* remainder */
  28. } ;
  29. #ifdef powerc
  30. #pragma options align=reset
  31. #endif
  32. typedef struct div_t div_t;
  33.  
  34. #ifdef powerc
  35. #pragma options align=power
  36. #endif
  37. struct ldiv_t {
  38.     long int quot;        /* quotient */
  39.     long int rem;        /* remainder */
  40. };
  41. #ifdef powerc
  42. #pragma options align=reset
  43. #endif
  44. typedef struct ldiv_t ldiv_t;
  45.  
  46. #ifndef NULL
  47. #define NULL 0
  48. #endif
  49.  
  50. #define EXIT_FAILURE 1
  51. #define EXIT_SUCCESS 0
  52.  
  53. #define RAND_MAX 32767
  54.  
  55. #define MB_CUR_MAX 1
  56.  
  57. #ifdef __cplusplus
  58. extern "C" {
  59. #endif
  60.  
  61. #ifdef __CFM68K__
  62.     #ifdef UsingSharedLibs
  63.         #pragma lib_export on
  64.     #endif
  65. #endif
  66.  
  67. /*
  68.  *    String conversion functions
  69.  */
  70.  
  71. double atof (const char *nptr);
  72. int atoi (const char *nptr);
  73. long int atol (const char *nptr);
  74. double strtod (const char *nptr, char **endptr);
  75. long int strtol (const char *nptr, char **endptr, int base);
  76. unsigned long int strtoul (const char *nptr, char **endptr, int base);
  77.  
  78.  
  79. /*
  80.  *    Pseudo-random sequence generation functions
  81.  */
  82.  
  83. int rand (void);
  84. void srand (unsigned int seed);
  85.  
  86.  
  87. /*
  88.  *    Memory management functions
  89.  */
  90.  
  91. void *calloc (size_t nmemb, size_t size);
  92. void free (void *ptr);
  93. void *malloc (size_t size);
  94. void *realloc (void *ptr, size_t size);
  95.  
  96.  
  97. /*
  98.  *    Communication with the environment
  99.  */
  100.  
  101. void abort (void);
  102. int atexit (void (*func)(void));
  103. void exit (int status);
  104. char *getenv (const char *name);
  105. int system (const char *string);
  106.  
  107.  
  108. /*
  109.  *    Searching and sorting utilities
  110.  */
  111.  
  112. void *bsearch (const void *key, const void *base,
  113.                size_t nmemb, size_t size,
  114.                int (*compar)(const void *, const void *));
  115. void qsort (void *base, size_t nmemb, size_t size,
  116.             int (*compar)(const void *, const void *));
  117.  
  118.  
  119. /*
  120.  *    Integer arithmetic functions
  121.  */
  122.  
  123. int abs (int j);
  124. div_t div (int numer, int denom);
  125. long int labs (long int j);
  126. ldiv_t ldiv (long int numer, long int denom);
  127.  
  128.  
  129. /*
  130.  *    Multibyte functions
  131.  */
  132.  
  133. int mblen (const char *s, size_t n);
  134. int mbtowc (wchar_t *pwc, const char *s, size_t n);
  135. int wctomb (char *s, wchar_t wchar);
  136. size_t mbstowcs (wchar_t *pwcs, const char *s, size_t n);
  137. size_t wcstombs (char *s, const wchar_t *pwcs, size_t n);
  138.  
  139. /*
  140.  *  Apple extentions
  141.  */
  142.  
  143. /* CFront can't handle the pretty version of this conditional 
  144. #if defined (__useAppleExts__) || \
  145.     ((defined (applec) && ! defined (__STDC__)) || \
  146.      (defined (__PPCC__) && __STDC__ == 0))
  147. */
  148. #if defined (__useAppleExts__) || ((defined (applec) && ! defined (__STDC__)) || (defined (__PPCC__) && __STDC__ == 0))
  149.  
  150. char *ecvt(extended value,int ndigit,int *decpt,int *sign); 
  151. char *fcvt(extended value,int ndigit,int *decpt,int *sign);
  152.  
  153. #endif
  154.  
  155. #ifdef __CFM68K__
  156.     #ifdef UsingSharedLibs
  157.         #pragma lib_export off
  158.     #endif
  159. #endif
  160.  
  161. #ifdef __cplusplus
  162. }
  163. #endif
  164.  
  165. #endif
  166.